package com.nmsl.controller;

import com.nmsl.domain.GyfMembership;
import com.nmsl.mapper.GyfMembershipMapper;
import com.nmsl.util.R.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/gyf")
@RestController
public class gyfMembershipController {
    @Autowired
    private GyfMembershipMapper gyfMembershipMapper;
    //通过患者id查询会员id
    @GetMapping("/selectMemberIdByPatientId")
    public R selectMemberIdByPatientId(@RequestParam Integer patientId) {
        GyfMembership gyfMembership = gyfMembershipMapper.selectMembershipIdByPatientId(patientId);
        if(gyfMembership != null) {
            return R.ok(gyfMembership);
        }else{
            return R.fail("没有找到该会员");
        }
    }
}
